package com.gaohe.controller;


import com.gaohe.common.R;
import com.gaohe.pojo.StadOrder;
import com.gaohe.service.StadOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author liu
 * @since 2025-04-12
 */
@RestController
@RequestMapping("/order")
public class StadOrderController {
    @Autowired
    private StadOrderService stadOrderService;
    @GetMapping("getMoneyAll/{id}")
    public R getMoneyAll(@PathVariable("id") Long id){
        List<StadOrder> allMoneyByUserId = stadOrderService.getAllMoneyByUserId(id);
        Double money=0.0;
        for (StadOrder stadOrder : allMoneyByUserId) {
            money+=Double.valueOf(stadOrder.getMoney());
        }
        return R.success(money);
    }
}

